
#pragma once
#include "stdafx.h"
#include "one.h"

#include "cvaux.h"
#include "highgui.h"

void people(IplImage* img)
{
	char stry1[1];
CvFont font;
double hscale=0.5; //use 1 for mine
double vscale=0.5; //use 1 for mine
int lineWidth=2; //use 1 for mine
cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC,hscale,vscale,0,lineWidth);

   
    cv::HOGDescriptor hog;
    hog.setSVMDetector(cv::HOGDescriptor::getDefaultPeopleDetector());
    cv::vector<cv::Rect> found;
  

    hog.detectMultiScale(img, found, 0, cv::Size(8,8), cv::Size(24,16), 1.05, 2);
   

    for( int i = 0; i < (int)found.size(); i++ )
    {
        cv::Rect r = found[i];
		  r.x =r.x+(0.5*(r.width));
        r.y=r.y+(0.5*(r.height)); 
  
     sprintf(stry1,"%d",i);
cvPutText(img,stry1,cvPoint((r.x),(r.y)),&font,cvScalar(0,0,255));
cvLine(img,cvPoint((r.x)+(0.5*(r.width)),(r.y)-(0.5*(r.height))),cvPoint((r.x)+(0.5*(r.width)),(r.y)+(0.5*(r.height))),cvScalar(255,0,0),2);//square

cvLine(img,cvPoint((r.x)+(0.5*(r.width)),(r.y)+(0.5*(r.height))),cvPoint((r.x)-(0.5*(r.width)),(r.y)+(0.5*(r.height))),cvScalar(255,0,0),2);//square

cvLine(img,cvPoint((r.x)-(0.5*(r.width)),(r.y)+(0.5*(r.height))),cvPoint((r.x)-(0.5*(r.width)),(r.y)-(0.5*(r.height))),cvScalar(255,0,0),2);//square

cvLine(img,cvPoint((r.x)-(0.5*(r.width)),(r.y)-(0.5*(r.height))),cvPoint((r.x)+(0.5*(r.width)),(r.y)-(0.5*(r.height))),cvScalar(255,0,0),2);//square
      
    }
 
}








 





